<!--未登录用户使用-->
{% if not current_user.is_authenticated %}
<h4>{{_("你好,游客")}}!</h4>
<div class="form-group">
  <input name="username" id="username" type="text" class="form-control osr-input"
         v-model="vst_username" minlength="1" placeholder="{{_('昵称')}}" required/>
</div>
<div class="form-group">
  <input name="email" id="email" type="text" class="form-control osr-input"
         v-model="vst_email" minlength="3" placeholder="{{_('电子邮箱')}}"
         data-bv-notempty-message="{{_('电子邮箱错误')}}"
         data-bv-stringLength-message="{{_('电子邮箱错误')}}" required/>
</div>
{% endif %}
<!--未登录用户使用-->

<div id="ct" class="form-group">
    <textarea id="comment"  name="comment" class="form-control" placeholder="{{_('写点你的评论')}}" style="height:70px"
    maxlength="300" minlength="2" data-bv-stringLength-message="{{_('最少2个字符, 最多300个字符')}}">
    </textarea>
</div>

<div class="form-group">
    <span class="osr-text">^_^{{_("请使用文明用语")}}</span>
    <div class="btn-group-sm pull-right">
        <button v-on:click="send_comment(null, post.user._id, post.user.username, null)" class="btn btn-info osr-btn">
            {{_("提交评论")}}
        </button>
    </div>
</div>
<br>
<h4 >{{_('评论')}} ({[post.comment_num]})</h4>
<!--导航-->
 <header class="panel-heading tab-bg-dark-navy-blue osr-panel-heading">
    <ul class="nav nav-tabs">
        <li id="head_li_sort_" class="active">
            <a data-toggle="tab" class="osr-pointer" v-on:click="get_comment(null, 1)">
                {{_("喜欢排序")}}
            </a>
        </li>
        <li id="head_li_sort_t-asc">
            <a data-toggle="tab" class="osr-pointer" v-on:click="get_comment('t-asc',1)">
                {{_("时间升序")}}
            </a>
        </li>
        <li id="head_li_sort_t-desc">
            <a data-toggle="tab" class="osr-pointer" v-on:click="get_comment('t-desc',1)">
                {{_("时间降序")}}
            </a>
        </li>
    </ul>
</header>

<ul class="osr-list-group">
    <li class="osr-list-group-item" v-for="(ct,index ) in comments.datas">
      <div class="item-content">
          <!--１级评论-->
          <header>
              <!--<figure class="comment&#45;&#45;userpic"><img src="" alt=""></figure>-->
                <strong>
                    <a v-if="ct.user_id && ct.user_id!='None'" :href="'/user?id='+ct.user_id">
                        {[ct.username]}
                    </a>
                    <a v-else >
                        [{{_('游客')}}]{[ct.username]}
                    </a>
                </strong>
                <time  class="osr-date">{[ct.issue_time | formatDate]}</time>
          </header>
          <!--正文-->
          <div class="osr-text">
            <div :id="'#comment'+ct._id" >{[ct.content]}</div>
          </div>
          <br>
          <div>
              <div class="pull-left">
                    <!--评论点赞-->
                  <span class="osr-pointer"  v-if="ct.like_it_already" :id="ct._id" v-on:click="ct_like(ct._id, index)" >
                     <i class="fa fa-thumbs-up osr-color-danger"></i> {[ct.like]}
                  </span>
                  <span class="osr-pointer" :id="ct._id"  v-else v-on:click="ct_like(ct._id, index)">
                     <i class="fa fa-thumbs-o-up osr-color-danger"></i> {[ct.like]}
                  </span>
                  &nbsp;
                  <!--回复评论-->
                    <a v-on:click="togle_comment_input(ct._id)" class="osr-pointer osr-color-success">
                        <i class="fa fa-comment-o"></i>
                           {{_("回复")}}
                    </a>
                  <!--//回复评论-->
              </div>

              {% if current_user.is_authenticated %}
              <!--登录用户才显示评论举报-->
              <div class="pull-right osr-date">

                  <!--删除-->
                    <a  v-if="ct.user_id==loged_user"  v-on:click="warning_modal(null, 'del_comment', ct._id, index)" class="osr-color-danger osr-pointer" >
                        {{_('删除')}}
                    </a>
                  <!--//删除-->

                    <span   v-else v-on:click="ready_inform_ct(ct)" class="osr-pointer" data-toggle="modal" data-target="#comment-inform">
                        {{_("举报")}}
                    </span>&nbsp;

              </div>
              {% endif %}
              <br>
              <!--１评论框-->
              <div :id="'reply-'+ct._id"  hidden>
                   <br>

                  <!--未登录用户使用-->
                  {% if not current_user.is_authenticated %}
                    <div class="form-group">
                      <input name="username" id="username" type="text" class="form-control osr-input"
                             v-model="vst_username" minlength="1" placeholder="{{_('昵称')}}" required/>
                    </div>
                    <div class="form-group">
                      <input name="email" id="email" type="text" class="form-control osr-input"
                             v-model="vst_email" minlength="3" placeholder="{{_('电子邮箱')}}"
                             data-bv-notempty-message="{{_('电子邮箱错误')}}"
                             data-bv-stringLength-message="{{_('电子邮箱错误')}}" required/>
                    </div>
                  {% endif %}
                <!--未登录用户使用-->

                  <div class="form-group">
                        <textarea :id="'comment'+ct._id"  :name="'comment'+ct._id" class="form-control" placeholder="{{_('写点你的评论')}}" style="height:70px"
                        maxlength="300" minlength="2" data-bv-stringLength-message="{{_('最多300个字符')}}" >
                        </textarea>
                  </div>

                  <div class="form-group">
                        <span class="osr-text">^_^{{_("请使用文明用语")}}</span>
                        <div class="btn-group-sm pull-right">
                            <button v-on:click="send_comment(ct._id, ct.user_id, ct.username, ct._id)" class="btn btn-info osr-btn">
                                {{_("回复评论")}}
                            </button>
                        </div>
                  </div>
              </div>

              <!--１评论框-->

          </div>
            <!--２级评论-->
            <ul class="osr-list-group-lv2">
                <li v-for="(treply, tindex) in ct.reply" class="osr-list-group-item-lv2">
                    <hr  v-if="tindex!=0" class="osr-hr" >
                    <header>
                        <strong>
                            <a v-if="treply.user_id && treply.user_id != 'None'" :href="'/user?id='+treply.user_id">
                                {[treply.username]}
                            </a>
                            <a v-else>
                                [{{_('游客')}}]{[treply.username]}
                            </a>

                        </strong>
                        <time class="osr-date">{[treply.issue_time | formatDate]}</time>
                    </header>

                    <div class="osr-text">
                        {{_('回复')}}
                        <a v-if="treply.reply_user_id && treply.reply_user_id != 'None'" :href="'/user?id='+treply.reply_user_id">
                            @{[treply.reply_username]}:
                        </a>
                        <a v-else>
                            @[{{_('游客')}}]{[treply.reply_username]}:
                        </a>

                        <div :id="'#comment'+treply._id" >{[treply.content]}</div>
                    </div>
                    <br>
                    <div class="pull-left">
                      <!--回复评论-->
                        <a v-on:click="togle_comment_input(treply._id)" class="osr-pointer osr-color-success">
                            <i class="fa fa-comment-o"></i>
                               {{_("回复")}}
                        </a>
                      <!--//回复评论-->
                    </div>
                    {% if current_user.is_authenticated %}
                    <!--登录用户才显示评论举报-->
                     <div class="pull-right osr-date">

                         <!--删除-->
                            <a  v-if="treply.user_id==loged_user"  v-on:click="warning_modal(null, 'del_comment', treply._id, index, tindex)"
                               class="osr-color-danger osr-pointer" >
                                {{_('删除')}}
                            </a>
                          <!--//删除-->

                        <span  v-else v-on:click="ready_inform_ct(treply)" class="osr-pointer" data-toggle="modal" data-target="#comment-inform">
                            {{_("举报")}}
                        </span>&nbsp;

                    </div>
                    {% endif %}

                    <br>
                      <!--2评论框-->
                      <div :id="'reply-'+treply._id"  hidden>
                           <br>
                          <!--未登录用户使用-->
                          {% if not current_user.is_authenticated %}
                            <div class="form-group">
                              <input name="username" id="username" type="text" class="form-control osr-input"
                                     v-model="vst_username" minlength="1" placeholder="{{_('昵称')}}" required/>
                            </div>
                            <div class="form-group">
                              <input name="email" id="email" type="text" class="form-control osr-input"
                                     v-model="vst_email" minlength="3" placeholder="{{_('电子邮箱')}}"
                                     data-bv-notempty-message="{{_('电子邮箱错误')}}"
                                     data-bv-stringLength-message="{{_('电子邮箱错误')}}" required/>
                            </div>
                          {% endif %}
                        <!--未登录用户使用-->

                          <div class="form-group">
                                <textarea :id="'comment'+treply._id"  :name="'comment'+treply._id" class="form-control" placeholder="{{_('写点你的评论')}}" style="height:70px"
                                maxlength="300" minlength="2" data-bv-stringLength-message="{{_('最多300个字符')}}" >
                                </textarea>
                          </div>

                          <div class="form-group">
                                <span class="osr-text">^_^{{_("请使用文明用语")}}</span>
                                <div class="btn-group-sm pull-right">
                                    <button v-on:click="send_comment(ct._id, treply.user_id, treply.username, treply._id)" class="btn btn-info osr-btn">
                                        {{_("回复评论")}}
                                    </button>
                                </div>
                          </div>
                      </div>

                      <!--2评论框-->
                </li>
            </ul>
            <!--２级评论//-->
      </div>
    </li>
</ul>
  <!--评论举报模态-->
    <div class="modal fade" id="comment-inform" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                    <h4 class="modal-title">{{_('评论举报')}}</h4>
                </div>
                <div class="modal-body">
                {% include "osr-theme-w/pages/based/_inform_modal_input.html" %}
                </div>
                <div class="modal-footer">
                    <button class="btn osr-btn btn-info" type="button" data-dismiss="modal" aria-hidden="true">
                        {{_("取消")}}
                    </button>
                    <button v-on:click="content_inform(ready_comment._id, 'comment', inform.category, inform.details)" class="btn osr-btn btn-success" type="button" data-dismiss="modal" aria-hidden="true">
                        {{_("提交")}}
                    </button>
                </div>
            </div>
        </div>
    </div>
    <!--评论举报模态框-->

<!-- 页面导航-->
<div class="text-center visible-lg visible-md">
    <ul class="pagination">
        <li  v-if="pages.last < pages.current_page && pages.last>0" >
            <a v-on:click="get_comment(sort, pages.last)">«</a>
        </li>
        <li  v-else class="disabled">
            <a>«</a>
        </li>

        <li v-for="page in pages.last_show" >
            <a  v-if="page!='...'" v-on:click="get_comment(sort, page)" >{[page]}</a>
            <a  v-else href="#">...</a>
        </li>

        <li class="active">
            <a v-on:click="get_comment(sort, pages.current_page)">{[pages.current_page]}</a>
        </li>

       <li v-for="page in pages.next_show" >
            <a  v-if="page!='...'" v-on:click="get_comment(sort, page)" >{[page]}</a>
            <a  v-else href="#">...</a>
       </li>

       <li  v-if="pages.next > pages.current_page && pages.next<=pages.page_total" >
            <a v-on:click="get_comment(sort, pages.next)">»</a>
        </li>
        <li  v-else class="disabled">
            <a>»</a>
        </li>
    </ul>
</div>
<!-- //页面导航-->
<!-- m页面导航-->
<ul class="pager visible-xs visible-sm">
    <li  v-if="pages.last < pages.current_page && pages.last>0" class="previous" >
        <a v-on:click="get_comment(sort, pages.last)">
            {{_("上一页")}}
        </a>
    </li>
    <li  v-if="pages.next > pages.current_page  && pages.next<=pages.page_total" class="next" >
        <a v-on:click="get_comment(sort, pages.next)">{{_("下一页")}}</a>
        </li>
</ul>
<!-- //m页面导航-->

<script src="/theme/osr-theme-w/static/js/osr_page_js/post/_comment.js?v={{g.site_global.site_config.STATIC_FILE_VERSION}}">
</script>